import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///查询输入框
class WidgetInquireBotton extends StatelessWidget {

  final TextInputType textInputType;
  final String hintText;
  final VoidCallback callback;

  const WidgetInquireBotton({Key key, this.textInputType, this.hintText, this.callback}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      padding: EdgeInsets.only(top: 10.0),
      alignment: Alignment.center,
      width: ScreenUtil().setWidth(750),
      margin: EdgeInsets.only(top: 5.0),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          _leftBtn(),
          _rightBtn(),
        ],
      ),
    );
  }

  Widget _rightBtn() {
    return InkWell(
      onTap:callback,
      child: Container(
        alignment: Alignment.center,
        height: ScreenUtil().setHeight(45),
        width: ScreenUtil().setWidth(100),
        decoration: BoxDecoration(
            color: Colors.blue,
            border:
                Border(right: BorderSide(color: Colors.black12, width: 0.5))),
        child: Text(
          '查询',
          style: TextStyle(color: Colors.white),
        ),
      ),
    );
  }

  Widget _leftBtn() {
    return Container(
      alignment: Alignment.center,
      height: ScreenUtil().setHeight(45),
      width: ScreenUtil().setWidth(410),
      decoration: BoxDecoration(
          border: Border(right: BorderSide(color: Colors.black12, width: 0.5))),
      child: TextField(
        maxLines: 1,
        keyboardType:textInputType,
        decoration: InputDecoration(
            hintText: '请输入卡号',
          contentPadding: EdgeInsets.only(top: 10.0),
        ),
        textAlign: TextAlign.center,
      ),
    );
  }
}
